import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteMockServe } from "vite-plugin-mock";

export default ({ command }) =>{
    return defineConfig({
        server: {
            host: '0.0.0.0',
            port: 8799
        },
        // base: '/admin/',
        base: '/',
        plugins: [
            vue(),
            viteMockServe({
                supportTs: false,
                localEnabled: true,
                prodEnabled: true,
                mockPath: 'src/mock'
            })
        ],
        resolve: {
            alias: {
                '@/': '/src/'
            }
        },
        css: {
            preprocessorOptions: {
                less: {
                    //additionalData: `@import "@/assets/base.less";`,
                }
            },
        },
        build: {
            terserOptions: {
                compress: {
                    drop_console: command !== 'server',
                    drop_debugger: command !== 'serve'
                }
            }
        }
    })
}
